<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
		<title>学生提交后的互评结果view</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css"/>
		<link rel="stylesheet" href="../../css/weui.min.css" />
		<link rel="stylesheet" href="../../css/mui.min.css" />
		<link rel="stylesheet" href="../../css/base.css"/>
		<style type="text/css" media="screen">
			html, body {
				background-color: #f3f5f7;
			}
			.top-hand-div-style {
				text-align: center;
				margin-top: 20px;
				background-color: #FFFFFF;
				border: 2px solid #FFFFFF;
				border-radius: 6px;
				margin-right: 10px;
				margin-left: 10px;
				padding-top: 20px;
				padding-bottom: 20px;
			}
			.div-full-screen2 {
				position: absolute;
				left: 0;
				right: 0;
				top: 220px;
				bottom: 0;
			}
			.top-hand-img-style {
				width: 120px;
				height: 120px;
				border-radius: 60px;
			}
			.top-hand-span-style {
				display: block;
				padding-bottom: 10px;
			}
			.bottom-btn-div {
				position: fixed;
				bottom: 0px;
				width: 100%;
				background-color: #18b4ed;
				color: #FFFFFF;
				line-height: 40px;
				text-align: center;
			}
			.colorblue {
				color: #18b4ed;
			}
			#middleId {
				margin-top: 10px;
			}
			.base_back_icon_right {
				height: 20px;
				position: absolute;
				top: 50%;
				right: 15px;
				margin-top: -11px;
			}
			#taiduNum1 > img {
				width: 24px;
				height: 24px;
				vertical-align: middle;
			}
		</style>
	</head>
	<body>
		<div id="mian"  hidden="hidden">
			<div class="top-hand-div-style" id="topHandId" >
				<img src="../../image/icon_head_ask_class.png"  class="top-hand-img-style" id="headImgId"/>
				<span class="base_content_font base_black_grey top-hand-span-style" id="headNameId" > 选择人员</span>
			</div>
			<div class="top-hand-div-style div-full-screen2 " id="middleId">
				<span class="base_title_font base_black_grey top-hand-span-style"  > <em   id="yNmuId"  class="colorblue">22</em>人已评</span>
				<span class="base_title_font base_black_grey top-hand-span-style" ><em   id="wNmuId"  class="colorblue">22</em>人未评</span>
				<span class="base_title_font base_black_grey top-hand-span-style"  > 平均得分:<em   id="averageId"  class="colorblue">55</em>分</span>
				<div  id="taiduNum1">
					<span class="base_content_font base_black_grey " >我的评分:</span>
					<img src="../../image/icon_xingxingblue01.png" id="imgId">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png">
					<img src="../../image/icon_xingxingblue01.png" hidden="hidden">
				</div>
			</div>
			<!--<div class="bottom-btn-div base_title_font" >
			你的评分：88
			</div>-->
		</div>
		<div class="noSign" hidden="hidden" id="noData" style="margin-top: 80px;">
			<img src="../../image/icon_mutalarating_nodata.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				老师未发起互评
			</p>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/jquery.min.js"></script>
	<script type="text/javascript" src="../../script/common.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script type="text/javascript" src="../../script/timeStampTool.js"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="TeacherMutualRatingJs.js"></script>
	<script type="text/javascript" src="../../script/push.js"></script>
	<script type="text/javascript">
		var currentStudents;
		var param = '';
		apiready = function() {
			showProgress();
			param = api.pageParam;
			api.closeWin({
				name : "MutualRatingDoScoreViewFram"
			});
			setRefreshHeader();
			getStatus();
			notice();
		};
		function notice() {
			api.addEventListener({
				name : 'pushMessage_classroomMessage'
			}, function(ret, err) {
				//			alert(MUTUAL_START_TYPE == ret.value.type && $api.getStorage('cfnetppjxid') == ret.value.jid);
				if (MUTUAL_START_TYPE == ret.value.type && $api.getStorage('cfnetppjxid') == ret.value.jid) {
					getStatus();
				}
			})
			//历史页面跳转过来
			api.addEventListener({
				name : 'openStudentMutualRatingViewWindNotice'
			}, function(ret, err) {
				var value = ret.value;
				//			     	alert("openStudentMutualRatingViewWindNotice=="+JSON.stringify(value));
				if (value) {
					if (value.status == 2) {
						$("#wancheng").hide();
					}
					$("#mian").show();
					loadData(value.id, value.stuid);
				}
			})
		}

		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				getStatus();
			});
		}

		//获取状态
		function getStatus() {
			var params = {
				jid : $api.getStorage('cfnetppjxid'),
				uid : $api.getStorage('cfnetppuid'),
				tid : "7",
				pid : api.pageParam.pid,
				cid : api.pageParam.cid,
			}
			//									alert(JSON.stringify(params));
			cfnetppPOST(url_getActiveStudentStatus, params, true, function(data, status) {
				//							    				alert(JSON.stringify(data));
				//				api.hideProgress();
				if (status == 'success') {
					if (data.code == 200) {
						api.hideProgress();
						var status = data.data.status;
						if (status == 1) {//开始
							if (data.data.student_status == 1) {//未评分
								api.hideProgress();
								var y = $('.base_navigation_bar').height() + 22;
								api.openFrame({
									name : 'MutualRatingDoScoreViewWind',
									url : 'MutualRatingDoScoreViewFram.html',
									rect : {
										x : 0,
										y : 0,
										w : 'auto',
										h : 'auto'
									},
									pageParam : {
										stuid : data.data.uid,
										id : data.data.id,
										name : data.data.stuname,
										picurl : data.data.picurl,
										pid : param.pid,
										cid : param.cid,
										sourceurl : window.location.pathname,
					                    sourcetitle : document.title
									}
								});
								$("#mian").hide();
							} else {
							     sendBuriedNotifi('0', '学生端互评结果页', '187');
								loadData(data.data.id, data.data.uid);
								$("#mian").show();
								$("#noData").hide();
							}
						} else {//未开始
							api.hideProgress();
							api.refreshHeaderLoadDone();
							$("#mian").hide();
							$("#noData").show();
						}
					} else {
						api.hideProgress();
						api.refreshHeaderLoadDone();
						$("#mian").hide();
						$("#noData").show();
					}
				} else {
					api.hideProgress();
					api.refreshHeaderLoadDone();
					$("#mian").hide();
					$("#noData").show();
				}
			})
		}

		//获取数据
		function loadData(id, stuid) {
			var params = {
				jid : $api.getStorage('cfnetppjxid'),
				tid : 7,
				iid : id,
				uid : stuid,
				page : 1,
				rows : 1,
			};
			//			     alert(JSON.stringify(params));
			cfnetppPOST(url_getMutualEvaluation, params, true, function(data, status) {
				//				  alert("数据"+JSON.stringify(data));
				hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.code == 200) {
						var students = data.data;
						setdata(students);
					}
				}
			});
		}
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjxid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}

		function setdata(data) {
			$("#headImgId").attr("src", headImgUrl(data.picurl));
			$("#headNameId").html(data.name);
			$("#yNmuId").html(data.numberscores);
			$("#wNmuId").html(data.nonumberscores);
			$("#averageId").html(data.average);
			//			$(".bottom-btn-div").html("你的评分:" + data.scores);
			var scores = parseInt(data.scores) / 20;
			$("#taiduNum1 img").eq(scores).prevAll().attr("src", "../../image/icon_xingxingblue.png")
		}
	</script>
</html>